﻿using UnityEngine;
using System.Collections.Generic;

public class PaddingData : ScriptableObject
{
    [System.Serializable]
    public class SpriteInfo
    {
        public string name;
        public Vector4 padding;

        public SpriteInfo() { }
        public SpriteInfo(string _name, Vector4 _padding) { name = _name; padding = _padding; }
    }

    [System.Serializable]
    public class AtlasInfo
    {
        public string name;
        public bool isPoly;
        public List<SpriteInfo> sprites;
    }

    public List<AtlasInfo> atlas;

    public void AddAtlas(string name, bool ispoly, List<SpriteInfo> sprites)
    {
        if (atlas == null)
        {
            atlas = new List<AtlasInfo>();
        }
        bool found = false;
        for (int i = 0; i < atlas.Count; ++i)
        {
            if (string.Equals(atlas[i].name, name))
            {
                atlas[i].sprites = sprites;
                found = true;
                break;
            }
        }

        AtlasInfo info = new AtlasInfo();
        info.name = name;
        info.sprites = sprites;
        info.isPoly = ispoly;

        atlas.Add(info);
    }
}
